import { Modal } from 'ant-design-vue'
import { ModalSize, modalConfig, Messages } from '@Config/config'
import { getCurrentInstance } from 'vue'

export const useWin = ({ component, attr }) => {
  let instance = getCurrentInstance()

  let win = ({ params = {}, attr2 }) => {
    let win = Modal.info({
      content: (
        <component
          instance={instance}
          onClose={() => {
            win.destroy()
            win = null
          }}
          {...params}
        />
      ),
      //appContext: instance,
      closable: true,
      width: ModalSize.middle,
      class: ['paddingContextModal', 'noFooterButtonModal'],
      ...attr,
      ...attr2,
    })
  }

  return [win]
}
